function send(obj) {
  var ret = '<xml>';
  for(var i in obj) {
    ret += '<' + i + '>' + '<![CDATA[' + obj[i]+ ']]></' + i + '>';
  }

  ret += '</xml>';
  return ret;
}

function TextMessage() {

}

TextMessage.prototype.say = function(obj) {
  var content = '感谢您的留言';
  var ret = {
    ToUserName: obj.FromUserName,
    FromUserName: obj.ToUserName,
    CreateTime: (new Date).getTime(),
    MsgType: obj.MsgType,
    MsgId: obj.MsgId,
    Content: content
  };
  return send(ret);
};

function ImageMessage() {

}

function Make (params) {
  this.params = params;
  this.msgType = params.MsgType;
  this.obj = null;

  this.init();
}

Make.prototype.init = function() {
  switch (this.msgType) {
    case 'text':
      this.obj = new TextMessage();
      break;
    case 'image':
      this.obj = new ImageMessage();
      break;
    default:

  }

  return this.obj;
}

Make.prototype.say = function() {
  return this.obj.say(this.params)
}

module.exports = Make;
